﻿using Taype.Trading.BTC.MtGoxAPIClient.JSONObjects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;

namespace MtGoxAPIClient_test
{
    
    
    /// <summary>
    ///This is b test class for MtGoxTickerItemTest and is intended
    ///to contain all MtGoxTickerItemTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MtGoxTickerItemTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in b class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for MtGoxTickerItem Constructor
        ///</summary>
        [TestMethod()]
        public void MtGoxTickerItemConstructorTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for getObjects
        ///</summary>
        [TestMethod()]
        public void getObjectsMtGoxTickerItemTest()
        {
            string jsonDataStr = "{\"ticker\":{\"high\":7.165,\"low\":6.1261,\"avg\":6.644817609,\"vwap\":6.639853399,\"vol\":169198,\"last_all\":6.7499,\"last_local\":6.7499,\"last\":6.7499,\"buy\":6.74742,\"sell\":6.7499}}";
            MtGoxTickerItem expected = new MtGoxTickerItem(7.165,6.1261,6.644817609,6.639853399,169198,6.7499,6.7499,6.7499,6.74742,6.7499);
            MtGoxTickerItem actual;
            actual = MtGoxTickerItem.getObjects(jsonDataStr);
            Assert.AreEqual(expected.avg, actual.avg);
            Assert.AreEqual(expected.buy, actual.buy);
            Assert.AreEqual(expected.high, actual.high);
            Assert.AreEqual(expected.last, actual.last);
            Assert.AreEqual(expected.last_all, actual.last_all);
            Assert.AreEqual(expected.last_local, actual.last_local);
            Assert.AreEqual(expected.low, actual.low);
            Assert.AreEqual(expected.sell, actual.sell);
            Assert.AreEqual(expected.vol, actual.vol);
            Assert.AreEqual(expected.vwap, actual.vwap);
        }

        /// <summary>
        ///A test for avg
        ///</summary>
        [TestMethod()]
        public void avgTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem(); // TODO: Initialize to an appropriate value
            double expected = 0.0; // TODO: Initialize to an appropriate value
            double actual;
            target.avg = expected;
            actual = target.avg;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for buy
        ///</summary>
        [TestMethod()]
        public void buyTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            double expected = 0.0;
            double actual;
            target.buy = expected;
            actual = target.buy;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for high
        ///</summary>
        [TestMethod()]
        public void highTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            double expected = 99;
            double actual;
            target.high = expected;
            actual = target.high;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for last
        ///</summary>
        [TestMethod()]
        public void lastTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            double expected = 5.6787;
            double actual;
            target.last = expected;
            actual = target.last;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for low
        ///</summary>
        [TestMethod()]
        public void lowTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            double expected = 0.1324;
            double actual;
            target.low = expected;
            actual = target.low;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for sell
        ///</summary>
        [TestMethod()]
        public void sellTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem(); // TODO: Initialize to an appropriate value
            double expected = 29.72;
            double actual;
            target.sell = expected;
            actual = target.sell;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for vol
        ///</summary>
        [TestMethod()]
        public void volTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem();
            double expected = 5648654;
            double actual;
            target.vol = expected;
            actual = target.vol;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for vwap
        ///</summary>
        [TestMethod()]
        public void vwapTest()
        {
            MtGoxTickerItem target = new MtGoxTickerItem(); // TODO: Initialize to an appropriate value
            double expected = 0F; // TODO: Initialize to an appropriate value
            double actual;
            target.vwap = expected;
            actual = target.vwap;
            Assert.AreEqual(expected, actual);
        }
    }
}
